import request from "@/utils/request";

/**
 * 登录接口类
 * @param login 登录
 * @param register 注册
 */
export class Login {
    static async login(data) {
        return request({
            url: '/api/login',
            method: 'POST',
            data
        })
    }

    static async register(data) {
        return request({
            url: '/admin/register',
            method: 'POST',
            data
        })
    }

    static async logout() {
        return request({
            url: `/user/logout/`,
            method: 'POST',
        })
    }
}

/**
 * 获取路由接口类
 */
export class DynamicRoutes {
    static async Info() {
        return request({
            url: '/routes/info',
            method: 'GET',
        })
    }

    static async Normal() {
        return request({
            url: '/menu/normal',
            method: 'GET',
        })
    }

    static async Add(data) {
        return request({
            url: '/routes/add',
            method: 'POST',
            data
        })
    }
    static async Change(data) {
        return request({
            url: '/routes/change',
            method: 'PUT',
            data
        })
    }

    static async Del(data) {
        return request({
            url: `/routes/del/${data}`,
            method: 'DELETE',
        })
    }

    static async isMenu(data) {
        return request({
            url: '/routes/ismenu',
            method: 'PUT',
            data
        })
    }
}

/**
 * 获取当前用户个人信息
 */
export class My {
    static async Info() {
        return request({
            url: '/my/info',
            method: 'GET',
        })
    }

    static async Update(data) {
        return request({
            url: '/my/update',
            method: 'PUT',
            data
        })
    }

    static async Reset(data) {
        return request({
            url: '/my/reset',
            method: 'PUT',
            data
        })
    }
}

/**
 * 获取所有用户信息
 */
export class UserInfo {
    static async Info() {
        return request({
            url: '/user/info',
            method: 'GET'
        })
    }

    static async Search(data) {
        return request({
            url: `/user/search/${data}`,
            method: 'GET'
        })
    }

    static async Del(data) {
        return request({
            url: `/user/del/${data}`,
            method: 'DELETE'
        })
    }
}

/**
 * 获取番剧信息
 */
export class Anime {
    static async Info() {
        return request({
            url: '/anime/info',
            method: 'GET'
        })
    }
}

/**
 * 获取番剧信息
 */
export class Comic {
    static async Info() {
        return request({
            url: '/comic/info',
            method: 'GET'
        })
    }
}

/**
 * 获取Gal信息
 */
export class GalGame {
    static async Add(data) {
        return request({
            url: '/galgame/add',
            method: 'POST',
            data
        })
    }

    static async Info() {
        return request({
            url: '/galgame/info',
            method: 'GET'
        })
    }

    static async Search(data) {
        return request({
            url: `/galgame/search/${data}`,
            method: 'GET'
        })
    }

    static async Update(data) {
        return request({
            url: '/galgame/update',
            method: 'PUT',
            data
        })
    }

    static async SoftDel(data) {
        return request({
            url: '/galgame/softDel',
            method: 'PUT',
            data
        })
    }

    static async IsShow(data) {
        return request({
            url: '/galgame/isShow',
            method: 'PUT',
            data
        })
    }

    static async Delete(data) {
        return request({
            url: `/galgame/del/${data}`,
            method: 'DELETE'
        })
    }
}

/**
 * 获取作者信息
 */
export class Authorship {
    static async Info() {
        return request({
            url: '/authorship/info',
            method: 'GET'
        })
    }
}

/**
 * 获取导演信息
 */
export class Director {
    static async Info() {
        return request({
            url: '/director/info',
            method: 'GET'
        })
    }
}

/**
 * 获取角色信息
 */
export class Roles {
    static async Add(data) {
        return request({
            url: '/roles/add',
            method: 'POST',
            data
        })
    }

    static async Info() {
        return request({
            url: '/roles/info',
            method: 'GET'
        })
    }

    static async Search(data) {
        return request({
            url: `/roles/search/${data}`,
            method: 'GET'
        })
    }

    static async Update(data) {
        return request({
            url: '/roles/update',
            method: 'PUT',
            data
        })
    }

    static async SoftDel(data) {
        return request({
            url: '/roles/softDel',
            method: 'PUT',
            data
        })
    }

    static async IsShow(data) {
        return request({
            url: '/roles/isShow',
            method: 'PUT',
            data
        })
    }

    static async Delete(data) {
        return request({
            url: `/roles/del/${data}`,
            method: 'DELETE'
        })
    }
}

/**
 * 获取声优信息
 */
export class VoiceActor {
    static async Info() {
        return request({
            url: '/voiceactor/info',
            method: 'GET'
        })
    }
}